
package com.probiz.estore.common.model.system.base;

import java.io.Serializable;
import java.util.Date;

import org.apache.commons.lang.builder.EqualsBuilder;
import org.apache.commons.lang.builder.HashCodeBuilder;
import org.apache.commons.lang.builder.ToStringBuilder;

import com.probiz.estore.common.model.customer.Membership;
import com.probiz.estore.common.model.system.AppUser;

/**
 * AppUser Base Java Bean
 * 
 * This class is the base class for the model
 * 
 */

public class AppUserTbl extends com.probiz.estore.core.model.BaseObject
		implements Serializable {

	protected Integer			appuserId;
	protected String			username;
	protected String			password;
	protected Short				userType;
	protected String			firstname;
	protected String			lastname;
	protected String			email;
	protected String			fax;
	protected String			zip;
	protected String			telephone;
	protected Short				status;
	protected Short				isLocked;
	protected Integer			createBy;
	protected Integer			updateBy;
	protected java.util.Date	createTime;
	protected java.util.Date	updateTime;
	protected Date				lastLoginTime;
	protected String			preferredLanguage;
	protected Integer			version;
	protected Short				deleted;

	protected Short				gender;
	protected Membership		membership;
	protected String			mobilephone;

	public Short getDeleted() {
		return deleted;
	}

	public void setDeleted(Short deleted) {
		this.deleted = deleted;
	}

	protected java.util.Set	userRoles	= new java.util.HashSet();

	/**
	 * 
	 * Default Empty Constructor for class AppUser
	 * 
	 */
	public AppUserTbl() {
		super();
	}

	/**
	 * 
	 * Default Key Fields Constructor for class AppUser
	 * 
	 */
	public AppUserTbl(Integer in_appuserId) {
		this.setAppuserId(in_appuserId);
	}

	public java.util.Set getUserRoles() {
		return userRoles;
	}

	public void setUserRoles(java.util.Set in_userRoles) {
		this.userRoles = in_userRoles;
	}

	/**
	 * 
	 * @return Integer
	 */
	public Integer getAppuserId() {
		return this.appuserId;
	}

	/**
	 * Set the appuserId
	 */
	public void setAppuserId(Integer aValue) {
		this.appuserId = aValue;
	}

	/**
	 * 
	 * @return String
	 */
	public String getUsername() {
		return this.username;
	}

	/**
	 * Set the username
	 */
	public void setUsername(String aValue) {
		this.username = aValue;
	}

	/**
	 * 
	 * @return String
	 */
	public String getPassword() {
		return this.password;
	}

	/**
	 * Set the password
	 */
	public void setPassword(String aValue) {
		this.password = aValue;
	}

	/**
	 * 
	 * @return Integer
	 */
	public Short getUserType() {
		return this.userType;
	}

	/**
	 * Set the userType
	 */
	public void setUserType(Short aValue) {
		this.userType = aValue;
	}


	/**
	 * 
	 * @return String
	 */
	public String getFirstname() {
		return this.firstname;
	}

	/**
	 * Set the firstname
	 */
	public void setFirstname(String aValue) {
		this.firstname = aValue;
	}

	/**
	 * 
	 * @return String
	 */
	public String getLastname() {
		return this.lastname;
	}

	/**
	 * Set the lastname
	 */
	public void setLastname(String aValue) {
		this.lastname = aValue;
	}

	/**
	 * 
	 * @return String
	 */
	public String getEmail() {
		return this.email;
	}

	/**
	 * Set the email
	 */
	public void setEmail(String aValue) {
		this.email = aValue;
	}

	/**
	 * 
	 * @return String
	 */
	public String getFax() {
		return this.fax;
	}

	/**
	 * Set the fax
	 */
	public void setFax(String aValue) {
		this.fax = aValue;
	}

	/**
	 * 
	 * @return String
	 */
	public String getZip() {
		return this.zip;
	}

	/**
	 * Set the zip
	 */
	public void setZip(String aValue) {
		this.zip = aValue;
	}

	/**
	 * 
	 * @return String
	 */
	public String getTelephone() {
		return this.telephone;
	}

	/**
	 * Set the telephone
	 */
	public void setTelephone(String aValue) {
		this.telephone = aValue;
	}

	/**
	 * 
	 * @return Integer
	 */
	public Short getStatus() {
		return this.status;
	}

	/**
	 * Set the status
	 */
	public void setStatus(Short aValue) {
		this.status = aValue;
	}

	/**
	 * 
	 * @return Short
	 */
	public Short getIsLocked() {
		return this.isLocked;
	}

	/**
	 * Set the isLocked
	 */
	public void setIsLocked(Short aValue) {
		this.isLocked = aValue;
	}


	public Short getGender() {
		return gender;
	}

	public void setGender(Short gender) {
		this.gender = gender;
	}

	public Membership getMembership() {
		return membership;
	}

	public void setMembership(Membership membership) {
		this.membership = membership;
	}
	
	public Integer getMembershipId() {
        return this.getMembership() == null ? null : this.getMembership().getMembershipId();
    }

    public void setMembershipId(Integer aValue) {
        if (aValue == null) {
        	membership = null;
        } else {
        	membership = new Membership(aValue);
        	membership.setVersion(Integer.valueOf(0));//set a version to cheat hibernate only
        }
    }


	/**
	 * 
	 * @return Integer
	 */
	public Integer getCreateBy() {
		return this.createBy;
	}

	/**
	 * Set the createBy
	 */
	public void setCreateBy(Integer aValue) {
		this.createBy = aValue;
	}

	/**
	 * 
	 * @return Integer
	 */
	public Integer getUpdateBy() {
		return this.updateBy;
	}

	/**
	 * Set the updateBy
	 */
	public void setUpdateBy(Integer aValue) {
		this.updateBy = aValue;
	}

	/**
	 * 
	 * @return java.util.Date
	 */
	public java.util.Date getCreateTime() {
		return this.createTime;
	}

	/**
	 * Set the createTime
	 */
	public void setCreateTime(java.util.Date aValue) {
		this.createTime = aValue;
	}

	/**
	 * 
	 * @return java.util.Date
	 */
	public java.util.Date getUpdateTime() {
		return this.updateTime;
	}

	/**
	 * Set the updateTime
	 */
	public void setUpdateTime(java.util.Date aValue) {
		this.updateTime = aValue;
	}

	/**
	 * 
	 * @return
	 */
	public Date getLastLoginTime() {
		return lastLoginTime;
	}

	/**
	 * 
	 * @param lastLoginTime
	 */
	public void setLastLoginTime(Date in_lastLoginTime) {
		this.lastLoginTime = in_lastLoginTime;
	}

	public String getPreferredLanguage() {
		return preferredLanguage;
	}

	public void setPreferredLanguage(String in_preferredLanguage) {
		this.preferredLanguage = in_preferredLanguage;
	}

	/**
	 * 
	 * @return Integer
	 */
	public Integer getVersion() {
		return this.version;
	}

	/**
	 * Set the version
	 */
	public void setVersion(Integer aValue) {
		this.version = aValue;
	}

	/**
	 * @see java.lang.Object#equals(Object)
	 */
	public boolean equals(Object object) {
		if (!(object instanceof AppUser)) {
			return false;
		}
		AppUser rhs = (AppUser) object;
		return new EqualsBuilder().append(this.appuserId, rhs.appuserId)
				.append(this.username, rhs.username).append(this.password,
						rhs.password).append(this.userType, rhs.userType)
				.append(this.firstname,
						rhs.firstname).append(this.lastname, rhs.lastname)
				.append(this.email, rhs.email).append(this.fax, rhs.fax)
				.append(this.zip, rhs.zip)
				.append(this.telephone, rhs.telephone).append(this.status,
						rhs.status).append(this.isLocked, rhs.isLocked).append(
						this.createBy, rhs.createBy).append(this.updateBy,
						rhs.updateBy).append(this.createTime, rhs.createTime)
				.append(this.updateTime, rhs.updateTime).append(this.version,
						rhs.version).append(this.mobilephone, rhs.mobilephone).isEquals();
	}

	/**
	 * @see java.lang.Object#hashCode()
	 */
	public int hashCode() {
		return new HashCodeBuilder(-82280557, -700257973)
				.append(this.appuserId).append(this.username).append(
						this.password).append(this.userType)
				.append(this.firstname).append(this.lastname)
				.append(this.email).append(this.fax).append(this.zip).append(
						this.telephone).append(this.status).append(
						this.isLocked).append(this.createBy).append(
						this.updateBy).append(this.createTime).append(
						this.updateTime).append(this.version).append(this.mobilephone).toHashCode();
	}

	/**
	 * @see java.lang.Object#toString()
	 */
	public String toString() {
		return new ToStringBuilder(this).append("appuserId", this.appuserId)
				.append("username", this.username).append("password",
						this.password).append("userType", this.userType)
				.append("firstname", this.firstname).append("lastname",
						this.lastname).append("email", this.email).append(
						"fax", this.fax).append("zip", this.zip).append(
						"telephone", this.telephone).append("status",
						this.status).append("isLocked", this.isLocked).append(
						"createBy", this.createBy).append("updateBy",
						this.updateBy).append("createTime", this.createTime)
				.append("updateTime", this.updateTime).append("version",
						this.version).append("mobilephone",this.mobilephone).toString();
	}

	/**
	 * Return the name of the first key column
	 */
	public String getFirstKeyColumnName() {
		return "appuserId";
	}
	
	/**
	 * 手机号码
	 * @return
	 */
	public String getMobilephone() {
		return mobilephone;
	}

	public void setMobilephone(String mobilephone) {
		this.mobilephone = mobilephone;
	}
	
	

}